<?php
    function database_connect()
    {
        include 'config.php';
        //connecting
        try {
            $db_connect = new PDO('mysql:host='.$host.';dbname='.$dbname, $user, $password,array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
            //$db_connect->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
            return $db_connect;
        } catch (PDOException $e) {
            echo "Can not connect:".$e->getMessage();
        }
    }
?>